package com.sfl.api_backend.controller.objModel;

import com.alibaba.fastjson2.JSON;
//import com.sfl.api_backend.service.impl.MqSendService;
import com.sfl.api_backend.utils.Api.RestResult;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author szc
 * @create 2023/3/27 18:58
 */
@RestController
@RequestMapping("/obj")
@Slf4j
public class ObjModelController {

    @Getter
    @Setter
    @NoArgsConstructor
    @AllArgsConstructor
    class UpdateModel{
        private Integer id;
        private String niiPath;
        private String savePath;
    }

//    @Resource
//    private MqSendService mqSendService;

    @PostMapping("/update")
    public RestResult update(UpdateModel updateModel)
    {
        try {
            log.info("update model: {}", updateModel);
//            mqSendService.sendModelUpdate(
//                    JSON.toJSONString(updateModel)
//            );
            return RestResult.success();
        }
        catch (Exception e)
        {
            log.error("update model error: {}", e.getMessage());
            return RestResult.error(500, e.getMessage());
        }
    }


}
